<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<input type="text" id="y"/>年
		<input type="text" id="m" />月
		<input type="button" id="btn" value="确定"/>
		<p id="jg"></p>
		<script type="text/javascript">
			var btn=document.getElementById("btn");
			btn.onclick=function () {
				var y=document.getElementById("y").value;
				var m=document.getElementById("m").value;
				var d1=new Date(y+"/"+m+"/"+1)
				var d2=new Date(y+"/"+(m-0+1)+"/"+1);				
				var days=(d2-d1)/(1000*60*60*24);
				document.getElementById("jg").innerText="该月有"+days+"天";
			}
		</script>
	</body>
</html>
